--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_kijin_seija = General:new(extension, "hy_kijin_seija", "chi_k", 4, 4, General.Female)
    local reverse = fk.CreateSkill {
        name = "reverse",
    }
    reverse:addEffect(fk.TargetSpecifying, {
        anim_type = "offensive",
        can_trigger = function(self, event, target, player, data)
            if not player:hasSkill(reverse.name) or player ~= target or (data.card.trueName ~= "slash" and not data.card:isCommonTrick()) then
                return false
            end
            if #player.player_cards[Player.Hand] > 0 then
                return (#data.to.player_cards[Player.Hand] < #player.player_cards[Player.Hand])
            end
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            local ids = room:askToCards(player, {
                min_num = 1,
                max_num = 1,
                include_equip = true,
                skill_name = reverse.name,
                prompt = "reverse_prompt2::" .. data.to.id
            })
            if type(ids) == "number" then
                ids = { ids }
            end
            event:setCostData(self, ids)
            return #ids > 0
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            local useData = room.logic:getCurrentEvent():findParent(GameEvent.UseCard, true).data
            local disresponsiveList = useData.disresponsiveList or {}
            table.insertIfNeed(disresponsiveList, data.to)
            useData.disresponsiveList = disresponsiveList
            room:throwCard(event:getCostData(self), reverse.name, player, player)
        end,
    })
    reverse:addEffect(fk.TargetConfirming, {
        can_trigger = function(self, event, target, player, data)
            if not player:hasSkill(reverse.name) or player ~= target or (data.card.trueName ~= "slash" and not data.card:isCommonTrick()) then
                return false
            end
            return (#data.from.player_cards[Player.Hand] > #player.player_cards[Player.Hand])
        end,
        on_cost = function(self, event, target, player, data)
            local room = player.room
            return room:askToSkillInvoke(player, {
                skill_name = reverse.name,
                prompt = "reverse_prompt1",
            })
        end,
        on_use = function(self, event, target, player, data)
            local room = player.room
            if not player.dead then
                room:drawCards(player, 1, reverse.name)
            end
        end,
    })
    local mirror_attack = fk.CreateSkill {
        name = "mirror_attack",
    }
    mirror_attack:addEffect("active", {
        anim_type = "offensive",
        target_num = 1,
        card_num = 0,
        can_use = function(self, player)
            return player:usedSkillTimes(mirror_attack.name, Player.HistoryPhase) == 0 and player:canUse(Fk:cloneCard("duel"))
        end,
        card_filter = Util.FalseFunc,
        target_filter = function(self, player, to_select, selected, selected_cards)
            return #selected == 0 and to_select ~= player and player:canUseTo(Fk:cloneCard("duel"), to_select)
        end,
        prompt = function(self, player, selected_cards, selected_targets)
            return "mirror_attack_prompt"
        end,
        on_use = function(self, room, skillUseEvent)
            local duel = Fk:cloneCard("duel")
            local player = skillUseEvent.from
            local target = skillUseEvent.tos[1]
            if not player.dead and not target.dead and player:canUseTo(Fk:cloneCard("duel"), target) then
                room:useCard({
                    from = player,
                    tos = { target },
                    card = duel,
                })
            end
            if not player.dead and not target.dead and target:canUseTo(Fk:cloneCard("duel"), player) then
                room:useCard({
                    from = target,
                    tos = { player },
                    card = duel,
                })
            end
        end,
    })
    extension:loadSkillSkels { reverse, mirror_attack }
    hy_kijin_seija:addSkills { "reverse", "mirror_attack" }
    Fk:loadTranslationTable {
        ["hy_kijin_seija"] = "鬼人正邪",
        ["#hy_kijin_seija"] = "覆世的野心",
        ["illustrator:hy_kijin_seija"] = "トリフネ",
        ["designer:hy_kijin_seija"] = "黑曜人形",
        ["cv:hy_kijin_seija"] = "",

        ["reverse"] = "逆转",
        [":reverse"] = "手牌数大于你的角色使用【杀】或普通锦囊牌指定你为目标时，你可以摸一张牌。你使用【杀】或普通锦囊牌指定手牌数小于你的角色为目标时，你可以弃置一张牌并令其无法响应此牌。",
        ["reverse_prompt1"] = "逆转:你可以摸一张牌",
        ["reverse_prompt2"] = "逆转：你可以弃一张牌并令%dest无法响应此牌",

        ["mirror_attack"] = "镜袭",
        [":mirror_attack"] = "出牌阶段限一次，你可以视为对一名其他角色使用【决斗】，然后其视为对你使用【决斗】。",
        ["mirror_attack_prompt"] = "镜袭：对一名其他角色视为使用【决斗】，然后其视为对你使用【决斗】"
    }
end
